package com.loongtech.bi.manager.realTime;

import com.loongtech.bi.entity.realTime.EntityAuanyTransferorder;
import com.loongtech.bi.manager.system.ConfigManager;
import com.loongtech.bi.synch.DataSyncher;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
import com.loongtech.core.util.Time;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * Author: yuri
 * Description:  实时数据-auany日充值用户及其金额manager
 * Date: 14:32 2017/4/11
 */
@Service
public class AuanyTransferorderManager extends ManagerQueryCacheBase<EntityAuanyTransferorder> {
	private static final long serialVersionUID = 1L;

    @Resource
    private ConfigManager configManager;

    public List<Object[]> getAuanyAddCashUserByChannel(Date lookDate) {
        return findByQuery("select platname,COUNT(DISTINCT fulluseridentity) from EntityAuanyTransferorder where gameid = ? and dt = ? group by platname", configManager.getConfigValueByName(DataSyncher.TagGameId),Integer.parseInt(Time.getDateStr(lookDate).replaceAll("-","")));
    }

    public List<Object[]> getAuanyTotalCashByChannel(Date lookDate) {
        return findByQuery("select platname,sum(gameproductamount) from EntityAuanyTransferorder where gameid = ? and dt = ? group by platname", configManager.getConfigValueByName(DataSyncher.TagGameId),Integer.parseInt(Time.getDateStr(lookDate).replaceAll("-","")));
    }
}
